import multiprocessing as mp
import time


def write_log(msg):
    with open('log.txt', 'a') as f:
        time.sleep(2)
        f.write(msg + '\n')


if __name__ == '__main__':
    p1 = mp.Process(target=write_log, args=('Process 1 is running',))
    p2 = mp.Process(target=write_log, args=('Process 2 is running',))
    p1.start()
    p2.start()
    p1.join()
    p2.join()
